package com.iworkh.spring.web.mvc.domain.vo;

import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Past;
import javax.validation.constraints.PositiveOrZero;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * 实体类Student
 *
 * @author: iworkh-沐雨云楼
 * @date: 2019-12-31
 */
public class Student {

    @NotEmpty
    private String name;

    @Range(min = 1, max = 200)
    private int age;

    @Size(min = 7, max = 11)
    private String phone;

    @NumberFormat(pattern = "#,###")
    @PositiveOrZero(message = "{money.not.validate}")
    private int money;

    @Past(message = "你来自未来时空吗？")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    @Override
    public String toString() {
        return "Student{" + "name='" + name + '\'' + ", age=" + age + ", phone='" + phone + '\'' + ", money=" + money + ", birthday=" + birthday + '}';
    }
}
